package net.oschina.git.fsppp.view.presneter;

import net.oschina.git.fsppp.common.baserx.RxSubscribe;
import net.oschina.git.fsppp.model.P3Dir;
import net.oschina.git.fsppp.model.SimpleResponse;
import net.oschina.git.fsppp.view.contract.PropertyContract;

import java.util.List;

/**
 * Created by QiHuang on 2016/10/21.
 */
public class PropertyPresenter extends PropertyContract.Presenter {
    public PropertyPresenter(PropertyContract.View view, PropertyContract.Model model) {
        super(view, model);
    }

    @Override
    public void getChildDirs(P3Dir dir) {
        mManager.add(mModel.getChildDirs(dir)
                .subscribe(new RxSubscribe<SimpleResponse<List<P3Dir>>>(mFrame) {
                    @Override
                    public void _onNext(SimpleResponse<List<P3Dir>> listSimpleResponse) {
                        mView.returnChildDirs(listSimpleResponse.getEntity());
                    }
                }));
    }
}
